﻿@model System.Collections.IList
@{
    ViewBag.Title = "HolidayRequestList";
    Layout = "~/Views/Shared/_BaseLayout.cshtml";
    var X = Html.X();
}
<h2>
    HolidayRequestList
</h2>
@section headtag
{
    <script>
        var linkDetail = function (value) {
            var temp = '<a href="#" onclick="PopHolidayRequest()" style="color:blue">{0}</a>';
            return Ext.String.format(temp, value);
        }

        var PopHolidayRequest = function () {
            document.getElementById("btnPopHolidayRequest").click();
        }
    </script>
}
@section example
{
    @(X.Viewport()
        .Layout(LayoutType.Border)
        .Items(
               X.Button()
                   .ID("btnPopHolidayRequest")
                   .Height(20)
                   .DirectEvents(de =>
                    {
                        de.Click.Url = Url.Action("PopHolidayRequest");
                    }),
                X.GridPanel()
                    .ID("gpHolidayRequestList")
                    .Region(Region.Center)
                    .Margins("5 5 5 5")
                    .Title("请假列表")
                    .Store(X.Store()
                            .Model(X.Model()
                                .Fields(
                                        new ModelField("ID", ModelFieldType.String),
                                        new ModelField("RequestReason", ModelFieldType.String),
                                        new ModelField("RequestStartDate", ModelFieldType.Date),
                                        new ModelField("RequestEndDate", ModelFieldType.Date),
                                        new ModelField("RequestDate", ModelFieldType.Date)
                                        )
                                    )
                            .DataSource(Model)
                            )
                    .ColumnModel(
                                    X.Column().Text("请假理由").DataIndex("RequestReason").Flex(1).Renderer("linkDetail"),
                                    X.DateColumn().Text("请假开始时间").DataIndex("RequestStartDate").Format("yyyy-MM-dd"),
                                    X.DateColumn().Text("请假结束时间").DataIndex("RequestEndDate").Format("yyyy-MM-dd"),
                                    X.DateColumn().Text("填写日期").DataIndex("RequestDate").Format("yyyy-MM-dd")
                                    )
               )
    )
}
